cmake_minimum_required(VERSION 2.8)
cmake_policy(PUSH)
cmake_policy(SET CMP0028 NEW)
cmake_policy(SET CMP0048 NEW)

project(task_dispatcher_lib_project
    VERSION 0.0.1
    LANGUAGES CXX
)

add_library(task_dispatcher_lib SHARED task_dispatcher.cpp task_dispatcher_impl.cpp thread_pool.cpp)

target_include_directories(task_dispatcher_lib
    PUBLIC
    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
    $<INSTALL_INTERFACE:include>
)

set(CMAKE_CXX_FLAGS -pthread)

INSTALL(FILES include/task_dispatcher.h DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/../output/include COMPONENT development)

INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/task_dispatcher-config.cmake
    DESTINATION ${LIBRARY_OUTPUT_PATH}/../cmake/ COMPONENT development)

add_custom_target(uninstall_task_dispatcher_lib
    COMMAND cat install_manifest.txt | xargs rm
    WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
    COMMENT "Uninstall")

cmake_policy(POP)